<?php
/* FILE: index.php
 * DESCRIPTION: Main page of the web site. User may sign in, reset password, or create an account.
 * POST DATA: user_name, user_password
 * GET DATA: err (error code)
 */ 
 
// Inialize session
session_start();

// Check, if user is already login, then jump to secured page
if (isset($_SESSION['user_name'])) {
header('Location: index_secure.php');
}

?>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<meta name="keywords" content="">
	<meta name="description" content="">
	<title>Collectionoid</title>
	<link rel="stylesheet" type="text/css" href="reset-fonts-grids.css">
	<link rel="stylesheet" type="text/css" href="base.css">
</head>
<body>
	<div id="doc2" class="yui-t1">
	  <div id="hd" style="padding-left:10px;">
	    <a href="./index.php">
	    	<img src="images/collectionoid_banner.png" alt="Collectionoid.com" height="100" width="922">
	 	</a>
	  </div>
	  <div id="bd">
	    <div id="yui-main">
			<div class="yui-b">
				<!-- MAIN CONTENT -->
				<div style="position:relative; left:475px; font-family:Georgia, 'Times New Roman', Times, serif;">
					Forget your password? <a href="password_reset.php">Click Here!</a>
				</div>
				<div style="margin: 25px 225px 25px 200px; padding: 25px 25px 25px 40px; width: 279px;">
					<?php
						$err = (string) $_GET['err'];
						switch($err){
							case 'ncf': echo "<font style=\"color:#FF0000; font-weight:bold;\">ERROR: No username/password combination found.<br><br></font>"; break;
							case 'denied': echo "<font style=\"color:#FF0000; font-weight:bold;\">ERROR: ACCESS DENIED<br><br></font>"; break;
							case 'resetsuccess': echo "<font style=\"color:#006600; font-weight:bold;\">SUCCESS: Password reset successfully.<br><br></font>"; break;
							case 'createsuccess': echo "<font style=\"color:#006600; font-weight:bold;\">SUCCESS: User created successfully.<br><br></font>"; break;
							default: echo ""; break;
						}
					?>
					<form action="process_submit.php" method="POST">
						<div style="padding-bottom:15px; font-family:Georgia, 'Times New Roman', Times, serif;">
							Username:<br><input type="text" name="user_name" style="width: 200px;">
							<br><br>
							Password:<br><input type="password" name="user_pass" maxlength="16" style="width: 200px;">
						</div>
						<div style="font-family:Georgia, 'Times New Roman', Times, serif;">
							<input type="submit" value="Login" style="width: 200px; font-size: medium; font-style: normal; font-variant: normal; font-weight: bold; line-height: normal; font-family: Arial, Helvetica, sans-serif;">
							<br>Not a member? <a href="newuser.php">Sign up now!</a>
						</div>
					</form>
				</div>
				<!-- END MAIN CONTENT -->
			</div>
	    </div>
	    <div class="yui-b">
	      <!-- AD GOES HERE -->
	      <div style="margin-top:20px; margin-left:20px; margin-bottom:20px; height:320px; border: 1px solid black;">
	      	<p>AD</p>
	      </div>
	    </div>
	  </div>
	  <div id="ft">
	    <div style="padding:10px 50px 10px 350px; font-family:Georgia, 'Times New Roman', Times, serif;">
	    	<a href="about.html">About</a> | 
	    	<a href="terms.html">Terms of Use</a> | 
	    	<a href="mailto:cwilkins1@gmail.com, jeff.rtitus@gmail.com">Contact the developers</a> 
	    </div>
	    <div style="padding:0 0 0 480px; font-family:Georgia, 'Times New Roman', Times, serif;">&copy; 2010</div>
	  </div>
	</div>
</body>
</html>
